package com.cooper.scraper.show;

import android.content.Context;
import android.graphics.Bitmap;

public abstract class FanartImgStrategy {
	
	protected Bitmap scaledImg(Bitmap fanartImg){
		
		Bitmap result = fanartImg;
		if (fanartImg != null
				&& ((result.getWidth() != (int) getFanartWidth()) || (result
						.getHeight() != (int) getFanartHeight()))) {
			result = Bitmap.createScaledBitmap(fanartImg, (int) getFanartWidth(),
					(int) getFanartHeight(), true);
			if (fanartImg != null && !fanartImg.isRecycled()) {
				fanartImg.recycle();
			}
		}
		return result;
	}

	public Bitmap handleFanartImg(Context context,Bitmap fanartImg){
		return getHandleFanartImg(context,scaledImg(fanartImg));
	}
	
	public abstract Bitmap getHandleFanartImg(Context context,Bitmap fanartImg);
	
	public abstract float getFanartHeight();
	
	public abstract float getFanartWidth();
}
